package com.hey.baseapplication.presenter;

import com.hey.baseapplication.api.DataListener;
import com.hey.baseapplication.bean.Event;
import com.hey.baseapplication.model.IMFModel;
import com.hey.baseapplication.view.IMFView;

import java.util.List;

/**
 * Created by Hey on 17/1/3.
 */

public class MFPresenter extends BasePresenter<IMFView,IMFModel> {

    public MFPresenter(IMFView view){
        mView=view;
        mModel=new IMFModel();
    }

    public void getData(){
        addSubscription(
        mModel.getData(mView.getEventApi(), new DataListener<List<Event>>() {
            @Override
            public void onSuccess(List<Event> events) {
                mView.setData(events);
            }

            @Override
            public void onError(Throwable e) {
                mView.onError(e);
            }
        })
        );
    }
}
